<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>login</title>
    <script src="js/axios.js"></script>
    <script src="js/vue.js"></script>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

    <!--CSS Stylesheet-->
    <link rel="stylesheet" href="css/login.css" type="text/css" media="all">

</head>
<body>
    <div class="signinform" id="registPage">
        <h1>中国非物质文化遗产</h1>
        <!-- container -->
        <div class="container">
            <!-- main content -->
            <div class="w3l-form-info">
                <div class="w3_info">
                    <h2>Register</h2>
                    <form action="#" method="post">
                        <div class="input-group">
                            <span><i class="fas fa-user" aria-hidden="true"></i></span>
                            <input type="email" placeholder="Username" required="" v-model="userNo">
                        </div>
                        <div class="input-group">
                            <span><i class="fas fa-key" aria-hidden="true"></i></span>
                            <input type="Password" placeholder="Password" required="" v-model="password">
                        </div>
                        <div class="form-row bottom">
                            <div class="form-check">
                                <!-- <input type="checkbox" id="remenber" name="remenber" value="remenber">
                                <label for="remenber"> Remember me?</label> -->
                            </div>
                        </div>
                        <button class="btn btn-primary btn-block" type="primary" v-on:click.prevent="regist">注册</button>
                    </form>
                    <!--<p class="account">Don't have an account? <a href="register.html">Sign up</a></p>-->
                </div>
            </div>
            <!-- //main content -->
        </div>
        <!-- //container -->
        <!-- footer -->
        <div class="footer">
            <p>Design in 2024</p>
        </div>
        <!-- footer -->
    </div>

    <script src="js/fontawesome.js"></script>

    <script>
        var vm = new Vue({
            el:"#registPage",
            data: {
                userNo:"",
                password:"",
            },
            methods: {
                regist:function(){
                    axios.post("https://localhost:7071/api/User",
                    {
                        name:this.userNo,
                        password:this.password,
                    }).then(function(res){
                    if(res.data==-1){
                        alert("密码必须包含大写字母、小写字母、数字和特殊字符，并且密码长度至少为8个字符")
                    }
                        console.log(res);
                        alert("注册成功");
                        location.href = "Login.html";
                    })
                }
            }
        })
    </script>
</body>
</html>
